/*
 RLEditRecyclingRunViewController.h
 Date Created: February 18, 2010
 
 Author: Karol Krizka <kkrizka@gmail.com>
 
 Copyright (C) 2010 Green-Power
 
 URL: http://code.google.com/p/green-power
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 $Id$
 */


#import <UIKit/UIKit.h>

#import "RLRecyclingRun.h"

/**
 * Manages the view that allows a user to edit a run. It is used when editing an
 * existing run or creating a new run.
 */
@interface RLEditRecyclingRunViewController : UIViewController<UIActionSheetDelegate> {
  UILabel *moneyEarnedLabel;
  UIButton *dateTimeButton;
  UIScrollView *editItemArea;
  
  RLRecyclingRun *run;
}

@property (nonatomic,retain) IBOutlet UILabel *moneyEarnedLabel;
@property (nonatomic,retain) IBOutlet UIButton *dateTimeButton;
@property (nonatomic,retain) IBOutlet UIScrollView *editItemArea;

/**
 * Initialize the view with the run. This is the only place where the run can be
 * set.
 *
 * \param run The run to edit.
 */
- (RLEditRecyclingRunViewController *)initWithRun:(RLRecyclingRun *)run;

/**
 * Updates the value label with the value of this run
 */
- (void)updateMoneyEarnedLabel;

/**
 * Updates the date/time button with the text of the run's date
 */
- (void)updateDateTimeButton;

/**
 * Setup the available buttons for editing recyclable types. Buttons for all
 * types in RLRecyclableType:listOfficialTypes are created. The buttons are also 
 * updated with the correct value as found in the run.
 */
- (void)setupEditItemButtons;

/**
 * Edit the date the run was made by popping up the date selector thing.
 */
- (IBAction)editDateTime:(id)sender;

/**
 * Popup the dialog for specifying the number of items
 */
- (IBAction)editItem:(id)sender;

/**
 * Hide the dialog for specifying the number of items.
 */
- (void)doneEditingItem;

/**
 * Hide the dialog for specifying the number of items and undo any changes made.
 */
- (void)undoEditingItem;

@end
